package me.lc;

import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class ShareSettingUtil {

	/**
	 * 获取String对象
	 * 
	 * @param key
	 * @return
	 */
	public static String getStringSetting(String key, SharedPreferences sp) {
		return sp.getString(key, "null");
	}

	/**
	 * 保存文本
	 * 
	 * @param key
	 * @param content
	 */
	public static void storeStringSetting(String key, String content,
			SharedPreferences sp) {
		Editor editor = sp.edit();
		editor.putString(key, content);
		editor.commit();
	}

	public static void storeIntSetting(String key, int content,
			SharedPreferences sp) {
		Editor editor = sp.edit();
		editor.putInt(key, content);
		editor.commit();
	}

	public static int getIntSetting(String key, int defaultValue,
			SharedPreferences sp) {
		return sp.getInt(key, defaultValue);
	}
}
